<template>
  <div id="videoPayback">
    <div class="container">
      <div class="videoPaybackButton">
        <el-select
          v-model="value1"
          placeholder="选择录像机"
          size="medium"
          style="margin-right: 2rem"
          @change="getcameralist()"
        >
          <el-option
            v-for="item in videoRecorderlist"
            :key="item.id"
            :label="item.deviceName"
            :value="item.id"
          ></el-option>
        </el-select>
        <el-select
          v-model="value2"
          placeholder="选择地点"
          size="medium"
          style="margin-right: 2rem"
        >
          <el-option
            v-for="item in cameralist"
            :key="item.id"
            :label="item.cover"
            :value="item.deviceNo"
          ></el-option>
        </el-select>

        <el-date-picker
          size="medium"
          style="width: 250px"
          v-model="value3"
          type="date"
          placeholder="选择日期"
        >
        </el-date-picker>
        <el-button
          size="medium"
          type="primary"
          style="margin-left: 1rem"
          >开始回放</el-button
        >
      </div>
      <div>
        <video
          style="width: 80%; height: 100%; margin: 0 auto; margin-left: 10%"
          controls
          ref="videoz"
          muted
          loop
          class="videoImg"
        >
          <source
            type="video/mp4"
            :src="video"
          />
        </video>
      </div>
    </div>
  </div>
</template>

<script>
import {
  videoRecorderlist,
  cameralist,
} from '/src/http/productSchedule/videoPlayback.js'

export default {
  data() {
    return {
      data: [],
      value1: '',
      value2: '',
      value3: '',
      videoRecorderlist: [],
      cameralist: [],
      video: require('/src/assets/video/32242783-preview.mp4'),
    }
  },
  components: {},
  created() {},
  mounted() {
    this.getvideoRecorderlist()
  },
  methods: {
    getvideoRecorderlist() {
      videoRecorderlist().then((res) => {
        if (res.code == 200) {
          console.log(res)
          this.videoRecorderlist = res.data
        }
      })
    },
    getcameralist() {
      this.value2 = ''
      cameralist({ videoRecorderId: this.value1 }).then((res) => {
        if (res.code == 200) {
          this.cameralist = res.data
        }
      })
    },
  },
}
</script>

<style lang="less" scoped>
#videoPayback {
  width: 100%;
  height: 100%;
  .container {
    width: 100rem;
    height: 50rem;
    margin-left: 30px;
    margin: 0 auto;
    margin-top: 0rem;

    .videoPaybackButton {
      margin: 0 auto;
      width: 60%;
      margin-bottom: 2rem;
    }
    h1 {
      text-align: center;
    }
    #echart {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
<style lang="less"></style>
